package com.example.doctor.controller;

import com.example.common.support.Result;
import com.example.doctor.dto.req.Add;
import com.example.doctor.dto.req.Delete;
import com.example.doctor.dto.req.Edit;
import com.example.doctor.dto.req.NoticeListReq;
import com.example.doctor.dto.resp.DoctorNoticeRsp;
import com.example.doctor.service.DoctorNoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author sifan
 * @PackagName:com.example.doctor.controller
 * @ClassName: NoticeController
 * @Description:
 * @date:2021/1/19 15:51
 */
@RestController
@Api(tags = "公告 列表")
@RequestMapping("/api/Notice")
public class NoticeController {

    @Resource
    DoctorNoticeService doctorNoticeService;

    @ApiOperation(value = "公告列表")
    @PostMapping("/List")
    public Result<Map<String,Object> > List(@RequestBody NoticeListReq req){
        Map<String,Object> list = doctorNoticeService.List(req);
        return Result.success(list);
    }

    @ApiOperation(value = "公告 添加")
    @PostMapping("/Add")
    public Result<Object> Add(@RequestBody Add add){
        doctorNoticeService.add(add);
        return Result.success();
    }

    @ApiOperation(value = "公告 修改")
    @PostMapping("/Edit")
    public Result<Object> Edit(@RequestBody Edit edit){
        doctorNoticeService.Edit(edit);
        return Result.success();
    }

    @ApiOperation(value = "公告 删除")
    @PostMapping("/Delete")
    public Result<Object> Delete(@RequestBody Delete delete){
        doctorNoticeService.Delete(delete);
        return Result.success();
    }

}
